"use strict";

function _defineProperty(e, t, s) {
    return t in e ? Object.defineProperty(e, t, {
        value: s,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[t] = s, e
}

function _createForOfIteratorHelper(e, t) {
    var s;
    if ("undefined" == typeof Symbol || null == e[Symbol.iterator]) {
        if (Array.isArray(e) || (s = _unsupportedIterableToArray(e)) || t && e && "number" == typeof e.length) {
            s && (e = s);
            var o = 0, t = function () {
            };
            return {
                s: t, n: function () {
                    return o >= e.length ? {done: !0} : {done: !1, value: e[o++]}
                }, e: function (e) {
                    throw e
                }, f: t
            }
        }
        throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
    }
    var a, r = !0, i = !1;
    return {
        s: function () {
            s = e[Symbol.iterator]()
        }, n: function () {
            var e = s.next();
            return r = e.done, e
        }, e: function (e) {
            i = !0, a = e
        }, f: function () {
            try {
                r || null == s.return || s.return()
            } finally {
                if (i) throw a
            }
        }
    }
}

function _unsupportedIterableToArray(e, t) {
    if (e) {
        if ("string" == typeof e) return _arrayLikeToArray(e, t);
        var s = Object.prototype.toString.call(e).slice(8, -1);
        return "Object" === s && e.constructor && (s = e.constructor.name), "Map" === s || "Set" === s ? Array.from(e) : "Arguments" === s || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s) ? _arrayLikeToArray(e, t) : void 0
    }
}

function _arrayLikeToArray(e, t) {
    (null == t || t > e.length) && (t = e.length);
    for (var s = 0, o = new Array(t); s < t; s++) o[s] = e[s];
    return o
}

var basicCostSwiper, hostList = [{code: "110100", city: "北京市", hostUrl: "//bjm.mumway.com"}, {
    code: "370200",
    city: "青岛市",
    hostUrl: "//qdm.mumway.com"
}, {code: "120100", city: "天津市", hostUrl: "//tjm.mumway.com"}, {
    code: "440100",
    city: "广州市",
    hostUrl: "//gzm.mumway.com"
}, {code: "440300", city: "深圳市", hostUrl: "//szm.mumway.com"}, {
    code: "430100",
    city: "长沙市",
    hostUrl: "//cshm.mumway.com"
}, {code: "140100", city: "太原市", hostUrl: "//tym.mumway.com"}, {
    code: "350100",
    city: "福州市",
    hostUrl: "//fzm.mumway.com"
}, {code: "420100", city: "武汉市", hostUrl: "//whm.mumway.com"}, {
    code: "510100",
    city: "成都市",
    hostUrl: "//cdm.mumway.com"
}, {code: "530100", city: "昆明市", hostUrl: "//kmm.mumway.com"}, {
    code: "330100",
    city: "杭州市",
    hostUrl: "//hzm.mumway.com"
}, {code: "610100", city: "西安市", hostUrl: "//xam.mumway.com"}, {
    code: "350200",
    city: "厦门市",
    hostUrl: "//xmm.mumway.com"
}, {code: "320100", city: "南京市", hostUrl: "//njm.mumway.com"}, {
    code: "320500",
    city: "苏州市",
    hostUrl: "//suzm.mumway.com"
}, {code: "340100", city: "合肥市", hostUrl: "//hfm.mumway.com"}, {
    code: "500100",
    city: "重庆市",
    hostUrl: "//cqm.mumway.com"
}, {code: "410100", city: "郑州市", hostUrl: "//zzm.mumway.com"}, {
    code: "330200",
    city: "宁波市",
    hostUrl: "//nbm.mumway.com"
}, {code: "140200", city: "大同市", hostUrl: "//dtm.mumway.com"}, {
    code: "210100",
    city: "沈阳市",
    hostUrl: "//sym.mumway.com"
}, {code: "130400", city: "邯郸市", hostUrl: "//hdm.mumway.com"}, {
    code: "230100",
    city: "哈尔滨市",
    hostUrl: "//hebm.mumway.com"
}, {code: "130100", city: "石家庄市", hostUrl: "//sjzm.mumway.com"}, {
    code: "360100",
    city: "南昌市",
    hostUrl: "//ncm.mumway.com"
}, {code: "441900", city: "东莞", hostUrl: "//dgm.mumway.com"}, {
    code: "450100",
    city: "南宁市",
    hostUrl: "//nnm.mumway.com"
}, {code: "210200", city: "大连市", hostUrl: "//dlm.mumway.com"}], allWebSite = [{
    region: "华北",
    list: [{store_name: "北京——总店", address: "北京市朝阳区北苑路170号凯旋城D座（5号楼）4层"}, {
        store_name: "北京——石景山分店",
        address: "北京市石景山区老古城前街1号中海金鑫阁4号楼7层"
    }, {store_name: "北京——朝阳分店", address: "北京市朝阳区广渠路3号竞园艺术中心商三"}, {
        store_name: "北京——丰台分店",
        address: "北京市丰台区草桥欣园二区九号楼C座3层"
    }, {store_name: "天津——南开区分店", address: "天津市南开区海光寺南京路349号新天地大厦20楼"}, {
        store_name: "河北——石家庄分店",
        address: "河北省石家庄市长安区建设北大街富邦大大厦三层西门"
    }, {store_name: "河北——邯郸市分店", address: "河北省邯郸市丛台区滏东北大街289号三龙大厦B座19层"}, {
        store_name: "山西——太原市分店",
        address: "山西省太原市小店区体育路亲贤街交叉口阳光大厦14层"
    }]
}, {
    region: "华东",
    list: [{store_name: "山东——青岛市北区分店", address: "山东省青岛市市北区辽源路305号鼎都商务楼4号楼2层"}, {
        store_name: "山东——青岛市城阳区分店",
        address: "山东省青岛市城阳区正阳中路国际商务港3楼"
    }, {store_name: "安徽——合肥市分店", address: "安徽省合肥市庐阳区长江中路319号仁和大厦16楼"}, {
        store_name: "福建——福州市分店",
        address: "福建省福州市鼓楼区八一七北路88号东百大厦A座1318"
    }, {store_name: "浙江——杭州市下城区分店", address: "浙江省杭州市下城区凤起路96号之俊大厦27楼"}, {
        store_name: "浙江——杭州市西湖区分店",
        address: "浙江省杭州市西湖区西溪银泰城1号楼10楼"
    }, {store_name: "福建——厦门市分店", address: "福建省厦门市思明区嘉禾路23号新景中心写字楼B座21层"}, {
        store_name: "江苏——苏州市分店",
        address: "江苏省苏州市姑苏区广济南路19号西城永捷生活广场8层"
    }, {store_name: "江苏——南京市分店", address: "江苏省南京市鼓楼区江中北路305号12B滨江广场14楼"}, {
        store_name: "江西——南昌市分店",
        address: "江西省南昌市红谷滩新区红谷中大道1368号鼎峰中央A座5层"
    }, {store_name: "江苏——无锡市分店", address: "江苏省无锡市梁溪区吉祥大厦4层"}, {
        store_name: "上海——徐汇区分店",
        address: "上海市徐汇区漕溪北路595号上海电影集团C座8层"
    }, {store_name: "浙江——温州市分店", address: "浙江省温州市鹿城区牛山北路仁信大厦9层"}, {
        store_name: "浙江——常州市分店",
        address: "浙江省常州市天宁区金百国际商业广场6栋西座10楼"
    }, {store_name: "浙江——宁波市分店", address: "浙江省宁波市鄞州区中兴路775号天润商座B座6楼"}]
}, {
    region: "华中",
    list: [{store_name: "湖北——武汉市江汉区分店", address: "湖北省武汉市江汉区解放大道374号崇光sogo写字楼A座1702室"}, {
        store_name: "湖北——武汉市洪山区分店",
        address: "湖北省武汉市洪山区欢乐大道1号德成国贸中心B栋30层"
    }, {store_name: "河南——郑州市分店", address: "河南省郑州市管城回族区紫荆山路59号裕鸿国际C座15楼"}, {
        store_name: "湖南——长沙市分店",
        address: "湖南省长沙市开福区芙蓉中路一段319号绿地中心T1栋2803室"
    }]
}, {
    region: "华南",
    list: [{store_name: "广州——广州市天河区分店", address: "广东省广州市天河区猎德大道48号之三尚东美御1803"}, {
        store_name: "广州——广州市白云区分店",
        address: "广东省广州市白云区机场路31号之一三元里中心8楼"
    }, {store_name: "广东——深圳市分店", address: "广东省深圳市福田区天安创新科技广场A座301"}, {
        store_name: "广东——东莞市分店",
        address: "广东省东莞市东城区金泽花园商住中心玉兰阁2楼A2-A8"
    }, {store_name: "广西——南宁市分店", address: "广西省南宁市青秀区金湖路26-1号东方国际商务港A座9层"}, {
        store_name: "广西——柳州市分店",
        address: "广西省柳州市柳南区航生路32号冠宇金都3层-A8"
    }]
}, {
    region: "东北",
    list: [{store_name: "辽宁——沈阳市分店", address: "辽宁省沈阳市沈河区十一纬路169号富中大厦5层"}, {
        store_name: "黑龙江——哈尔滨市分店",
        address: "黑龙江省哈尔滨市香坊区中山路172号常青国际大厦19楼"
    }, {store_name: "吉林——长春市分店", address: "吉林省长春市南关区南湖大路1999号南湖假日酒店盛京银行2楼"}, {
        store_name: "辽宁——大连市分店",
        address: "辽宁省大连市中山区友好路158号友好大厦4层-A8"
    }]
}, {
    region: "西北",
    list: [{store_name: "陕西——西安市雁塔区分店", address: "陕西省西安市雁塔区唐延路旺座国际城C座30层"}, {
        store_name: "陕西——西安市未央区分店",
        address: "陕西省西安市未央区未央路164号西双威迎宾广场9号楼商铺3层"
    }]
}, {
    region: "西南",
    list: [{store_name: "四川——成都市锦江区分店", address: "四川省成都市锦江区东大街牛王庙段成都商会大厦B座9层"}, {
        store_name: "四川——成都市高新区分店",
        address: "四川省成都市高新区天府三街218号附32号峰汇中心1号楼3楼"
    }, {store_name: "云南——昆明市五华区分店", address: "云南省昆明市五华区青年路389号志远大厦24楼B座"}, {
        store_name: "云南——昆明市月子中心",
        address: "云南省昆明市盘龙区龙溪路99号惠玥温德姆酒店25层"
    }, {store_name: "重庆——江北区分店", address: "重庆市江北区观音桥建新北路一支路6号未来国际10层"}, {
        store_name: "贵州——贵阳市分店",
        address: "贵州省贵阳市云岩区中华北路184号天毅大厦19楼"
    }]
}], common = {
    baseurl: "https://saas-apis.mumway.com", init: function () {
        this.bind(), this.fLocalHost(), this.fSingleRotation(), this.fChangeCity(), this.fTab(), this.fGetCityCode()
    }, bind: function () {
        var a = this;
        $(".jsMenu").on("click", function () {
            $(".jsMenuNav,.jsBg").toggle()//, $("body,html").addClass("overflow")
        }), $(document).click(function (e) {
            var t = $(".jsMenu");
            t.is(e.target) || 0 !== t.has(e.target).length || ($(".jsMenuNav,.jsBg").hide(), $("body,html").removeClass("overflow"))
        }), $(window).scroll(function () {
            $(".jsMenuNav,.jsBg").hide()
        }), $(".jsBaojia").on("click", function () {
            $(".jsPopupBj").show(), $("body").addClass("overflow")
        }), $(".jsBjSubBtn").on("click", function () {
            a.fSubmitBj(".jsPopupBj")
        }), $(".jsYs").on("click", function () {
            $(".jsPopupYs").show(), $("body").addClass("overflow")
        }), $(".jsYsSubBtn").on("click", function () {
            a.fSubmitBj(".jsPopupYs")
        }), $(".jsCalcSubBtn").on("click", function () {
            a.fSubmitBj(".jsYsCalcBox")
        }), $(".jsJobList a").each(function () {
            $(this).on("click", function () {
                $(".jsJoinusPop").show()
            })
        }), $(".jsClose").on("click", function () {
            $(".popupBox").hide(), $("body").removeClass("overflow"), $(".jsDateErrorMsg,.jsErrorMsg").html(""), $(".jsPhone,.jsDate,.jsName").val("")
        }), $(".jsYsCalcBox").find(".jsAyType").on("change", function () {
            var e = $(this).val();
            $(".jsDateErrorMsg,.jsErrorMsg").html(""), "育儿嫂" == e ? ($(".jsTitleType").html("宝宝生日"), $(".jsDate").attr("placeholder", "选择宝宝生日")) : "月嫂" == e && ($(".jsTitleType").html("预产期"), $(".jsDate").attr("placeholder", "选择预产期"))
        });
        localStorage.getItem("city"), localStorage.getItem("cityCode");
        this.fGetThisCity(), $(".jsRelocation").on("click", function () {
            $(".jsSwitchCity").show()
        }), $(".jsYesCity").on("click", function () {
            a.fGetThisCity(), $(".jsSwitchCity").hide(), $(".jsCityWrap").hide(), $("html").scrollTop(0)
        }), $(".jsSwiperWrap").delegate(".jsAppMent", "click", function () {
            $(".jsYsCalcBox").show(), $("body").addClass("overflow"), $(".jsYsCalcBox .jsAyType").removeAttr("checked"), $(".jsYsCalcBox .jsAyTypeCh").prop("checked", "checked"), $(".jsYsCalcBox .jsTitleType").html("预产期"), $(".jsYsCalcBox .jsDate").attr("placeholder", "选择预产期")
        }), $(".jsYsCalc").on("click", function () {
            $(".jsYsCalcBox").show(), $("body").addClass("overflow"), $(".jsYsCalcBox .jsAyType").removeAttr("checked"), $(".jsYsCalcBox .jsAyTypeCh").prop("checked", "checked"), $(".jsYsCalcBox .jsTitleType").html("预产期"), $(".jsYsCalcBox .jsDate").attr("placeholder", "选择预产期")
        }), $(".jsSubBtn").on("click", function () {
            a.fSubmitBj(".jsAppMentBox")
        }), $(".jsCityList").on("click", "li", function () {
            var e = $(this).html(), t = $(this).data("code");
            $(".jsCityWrap").hide(), $(".jsErrorMsg").html(""), $(".jsSearchCity").val(""), $(".jsCityName").html(e), $(".jsCityName").attr("code", t), $("html").scrollTop(0), localStorage.setItem("city", e), localStorage.setItem("cityCode", t), a.fGetChannelId(t);
            var s = _createForOfIteratorHelper(hostList);
            try {
                for (s.s(); !(o = s.n()).done;) {
                    var o = o.value;
                    if (o.code == t) {
                        window.location.replace(o.hostUrl);
                        break
                    }
                }
            } catch (e) {
                s.e(e)
            } finally {
                s.f()
            }
        }), $(".jsItem a,.jsMenuNav a,.jsFooterNav a").on("click", function (e) {
            var t = $(this).data("clasedcode");
            localStorage.setItem("clasedcode", t)
        });
        var e = $(".jsFooterNav a.active").data("clasedcode");
        e && localStorage.setItem("clasedcode", e), $(".jsCloseCityName").on("click", function () {
            $(".jsCityWrap").hide(), $("html").scrollTop(0)
        })
    }, fSubmitBj: function (e) {
        var t = $(e).find(".jsPhone").val(), s = $(e).find(".jsName").val(), o = {
            city: $(e).find(".jsCity").find("option:selected").text(),
            work_type: $(e).find(".jsAyType:checked").val(),
            phone: t,
            name: s,
            expected_date: $(e).find(".jsDate").val()
        };
        if (".jsYsCalcBox" == e) {
            if ("" == $(".jsYsCalcBox .jsDate").val()) return "月嫂" == $(e).find(".jsAyType:checked").val() ? $(".jsDateErrorMsg").html("请选择预产期！") : $(".jsDateErrorMsg").html("请选择宝宝生日！"), !1;
            $(".jsDateErrorMsg").html("")
        }
        if ("" == s) return $(e).find(".jsName").focus(), $(e).find(".jsName").next(".jsErrorMsg").html("请输入您的称呼！"), !1;
        $(e).find(".jsName").next(".jsErrorMsg").html(""), "" == t ? ($(e).find(".jsPhone").focus(), $(e).find(".jsPhone").next(".jsErrorMsg").html("请输入您的手机号码！")) : /^0{0,1}(13[0-9]|15[0-9]|17[0-9]|18[0-9])[0-9]{8}$/.test(t) ? $.post("//oa.mumway.com/index/activity/addServiceOffers", JSON.stringify(o), function (e) {
            1 == e.success ? ($(".popupBox").hide(), $(".jsSuccess").show()) : alert(e.msg)
        }) : ($(e).find(".jsPhone").focus(), $(e).find(".jsPhone").next(".jsErrorMsg").html("手机号码格式有误，请重新输入！"))
    }, fLocalHost: function () {
        window.location.host;
        $("footer").attr("host", "http://oa.mumway.com")
    }, fSwiper: function () {
        basicCostSwiper = new Swiper(".jsSwiperWrap", {
            watchSlidesProgress: !0,
            slidesPerView: "auto",
            centeredSlides: !0,
            loop: !0,
            loopedSlides: 3,
            navigation: {nextEl: ".button_next", prevEl: ".button_prev"},
            pagination: {el: ".swiper-pagination", clickable: !0},
            on: {
                progress: function (e) {
                    for (var t = 0; t < this.slides.length; t++) {
                        var s = this.slides.eq(t), o = this.slides[t].progress, a = 1;
                        1 < Math.abs(o) && (a = .3 * (Math.abs(o) - 1) + 1);
                        var r = o * a * 0 + "px", i = 1 - Math.abs(o) / 3, a = 999 - Math.abs(Math.round(10 * o));
                        s.transform("translateX(" + r + ") scale(" + i + ")"), s.css("zIndex", a), s.css("opacity", 1), 3 < Math.abs(o) && s.css("opacity", 0)
                    }
                }, setTransition: function (e) {
                    for (var t = 0; t < this.slides.length; t++) this.slides.eq(t).transition(e)
                }
            }
        })
    }, fSingleRotation: function () {
        var e;
        new Swiper(".singleSwiper", (_defineProperty(e = {
            loop: true,
            speed: 150,
            autoplay: !0,
            slidesPerView: 2
        }, "autoplay", {
            disableOnInteraction: !1,
            delay: 1500
        }), _defineProperty(e, "pagination", {el: ".swiper-pagination"}), e))
    }, fGetThisCity: function () {
        $(".jsCityName").html("定位中");
        var e = "北京市", t = "110100", s = _createForOfIteratorHelper(hostList);
        try {
            for (s.s(); !(o = s.n()).done;) {
                var o = o.value;
                if (-1 < window.location.href.indexOf(o.hostUrl)) {
                    e = o.city, t = o.code;
                    break
                }
            }
        } catch (e) {
            s.e(e)
        } finally {
            s.f()
        }
        localStorage.setItem("city", e), localStorage.setItem("cityCode", t), $(".jsCityName").html(e)
    }, fChangeCity: function () {
        var t;
        $(".jsChangeCity").on("click", function () {
            $(".jsCityWrap").show(), $(".jsCityWrap").scrollTop(0)
        }), $(".jsSearchCity").on("input propertychange", function () {
            var s = $(this).val(), e = $(".allcity li");
            clearTimeout(t), t = setTimeout(function () {
                $.each(e, function (e, t) {
                    if (s.length && "" != s) {
                        if (s == $(this).data("city")) return $(".jsCityName").html(s), $(".jsCityWrap").hide(), $("html").scrollTop(0), $(".jsErrorMsg").html(""), $(".jsSearchCity").val(""), localStorage.setItem("city", s), !1;
                        $(".jsErrorMsg").html("该地区不存在，请重新输入")
                    } else $(".jsErrorMsg").html("")
                })
            }, 600)
        })
    }, fGetCity: function () {
        $.ajax({
            type: "get",
            url: this.baseurl + "/news/v1/newscity",
            contentType: "application/json",
            success: function (e) {
                for (var t = e.data || [], s = "", o = 0; o < t.length; o++) s += '<option value="'.concat(t[o].city_id, '">').concat(t[o].city_name, "</option>");
                $(".jsCity").each(function () {
                    $(this).html(s)
                })
            },
            error: function () {
                console.log("error")
            }
        })
    }, fGetCityCode: function () {
        var r = this;
        $.ajax({
            type: "get",
            url: this.baseurl + "/news/v1/newscity",
            headers: {"X-AUTH-APPID": "s3005"},
            contentType: "application/json",
            success: function (e) {
                for (var t = e.data || [], s = "", o = "", a = 0; a < t.length; a++) o += '<li data-code="'.concat(t[a].city_id, '">').concat(t[a].city_name, "</li>"), s += '<option value="'.concat(t[a].city_id, '">').concat(t[a].city_name, "</option>");
                $(".jsCityList").html(o), $(".jsCity").each(function () {
                    $(this).html(s)
                });
                e = localStorage.getItem("cityCode");
                $(".jsCityName").attr("code", e), r.fGetChannelId(e)
            },
            error: function () {
                console.log("error")
            }
        })
    }, fGetChannelId: function (o) {
        var a = this;
        $.ajax({
            type: "get",
            url: this.baseurl + "/api/website/v1/tag/?classed_id=101",
            headers: {"X-AUTH-APPID": "s3005"},
            contentType: "application/json",
            success: function (e) {
                var t, e = e.data.ret_list, s = localStorage.getItem("clasedcode") || "1011";
                e.map(function (e) {
                    e.code == s && (t = e.id)
                }), t && a.fGetSwiperList(o, t)
            }
        })
    }, fGetSwiperList: function (e, t) {
        var s = this;
        basicCostSwiper && basicCostSwiper.destroy(!1), $.ajax({
            type: "get",
            url: "".concat(this.baseurl, "/api/website/v1/goods/?city_code=").concat(e, "&channel_id=").concat(t),
            headers: {"X-AUTH-APPID": "s3005"},
            contentType: "application/json",
            success: function (e) {
                var e = e.data.ret_list || [], t = "";
                e.length && (e.map(function (e) {
                    t += '<div class="swiper-slide"><div class="sbox"><div class="mbd cf"><img src="'.concat(e.app_img, '"class="fl"alt="').concat(e.name, '"/><div class="desc fl"><h3 class="title pink pb10">').concat(e.name, '</h3><p class="g6 f18 mb10">').concat(e.desc, '</p><span class="pink f34">').concat(e.price / 100, "元/起</span></div></div></div></div>")
                }), $(".jsSwiper").html(t), s.fSwiper())
            },
            error: function () {
                console.log("error")
            }
        })
    }, fTab: function () {
        var t, s = this;
        $(".jsTab a").on("click", function () {
            var e = $(this).index();
            t = $(this).html(), $(".jsTab a.active").removeClass("active"), $(this).addClass("active"), $(".jsContent.show").removeClass("show"), $(".jsContent").eq(e).addClass("show"), s.fWebSite(t)
        })
    }, fWebSite: function (t) {
        var s = "";
        allWebSite.map(function (e) {
            e.region == t && e.list.map(function (e) {
                s += '<li><p class="f26 g3">'.concat(e.store_name, '</p><p class="f24 g6 address">').concat(e.address, "</p></li>")
            })
        }), $(".jsContent ul").html(s)
    }
};
common.init();